<?php
$countPost = count( $this->posts );
if( !Session::get( 'authenticated' ) ) :

    header( 'location: '.URL_BASE );
    exit;

endif;
?>
<!DOCTYPE html>
<html lang="en">
<head prefix="og: http://ogp.me/ns#">
    <meta charset="utf-8" />
    <base href="<?php echo URL_BASE; ?>" target="_top" />
    <title><?php echo $totalNotifications; if( isset( $this->title ) ) : echo $this->title.' - '; endif; ?><?php echo SITE_NAME; ?></title>
    <meta name="description" content="<?php if( isset( $this->title ) ) : echo $this->description.' - '; endif; echo DESCRIPTION_SITE; ?>" />
    <meta name="keywords" content="<?php echo KEYWORDS_SITE; ?>" />

    <link href="<?php echo $_layoutParams['root_css']; ?>styles.css" rel="stylesheet" type="text/css" />

    <?php if(isset($this->image) && $this->image != ''){
        $photoUrl = 'http://'.$_SERVER['HTTP_HOST'].'/upload/'.$this->image;
    }else{
        $photoUrl = 'http://'.$_SERVER['HTTP_HOST'].'/public/img/logo250.png';
    }

    ?>
    <meta property="fb:app_id"          content="1505522613016076" />
    <meta property="og:type"            content="website" />
    <meta property="og:url"             content="http://<?= $_SERVER['HTTP_HOST'] ?>/ask/<?=$this->title?>" />
    <meta property="og:title"           content="<?=$this->title?>" />
    <meta property="og:image"           content="<?= $photoUrl?>" />
<!--    <meta property="cookbook:author"    content="" />-->

    <link rel="stylesheet" type="text/css" href="<?php echo $_layoutParams['root_css']; ?>reset.css" charset="UTF-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
    <script type="text/javascript" src="<?php echo $_layoutParams['root_js']; ?>modernizr.custom.js"></script>
    <link rel="shortcut icon" href="<?php echo $_layoutParams['root_img']; ?>favicon.png" />
    <link rel="stylesheet" href="http://<?php echo $_SERVER['HTTP_HOST']?>/public/js/jrating/jRating.jquery.css" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <script type="text/javascript">
        window.fbAsyncInit = function () {
            FB.init({
                appId: '1505522613016076', // replace your app id here
                status: true,
                cookie: true,
                xfbml: true
            });
        };
        (function (d) {
            var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
            if (d.getElementById(id)) {
                return;
            }
            js = d.createElement('script');
            js.id = id;
            js.async = true;
            js.src = "//connect.facebook.net/en_US/all.js";
            ref.parentNode.insertBefore(js, ref);
        }(document));

        function FBLogin() {
            var host = 'http://' + window.location.host + '/public/ajax/facebooklogin.php';

            FB.login(function (response) {
                if (response.authResponse) {
                    window.location.href = host;
                }
            }, {scope: 'publish_actions'});
        }
        function checkFBLogin(){
            FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {
                    // the user is logged in and has authenticated your
                    // app, and response.authResponse supplies
                    // the user's ID, a valid access token, a signed
                    // request, and the time the access token
                    // and signed request each expire
                    var uid = response.authResponse.userID;
                    var accessToken = response.authResponse.accessToken;
                    return true;
                } else if (response.status === 'not_authorized') {
                    // the user is logged in to Facebook,
                    // but has not authenticated your app
                    FBLogin();
                } else {
                    // the user isn't logged in to Facebook.
                    window.location.href=('https://facebook.com');
                }
            });
        }
    </script>
<style>
    body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
    [class^=slider] { display: inline-block; margin-bottom: 30px; }
    .output { color: #888; font-size: 14px; padding-top: 1px; margin-left: 5px; vertical-align: top;}
    h1 { font-size: 20px; }
    h2 { clear: both; margin: 0; margin-bottom: 5px; font-size: 16px; }
    p { font-size: 15px; margin-bottom: 30px; }
    h2:first-of-type { margin-top: 0; }
</style>
<style>

    body
    {
        background-position: <?php echo $this->infoSession->bg_position; ?> 55px;
        background-attachment: <?php echo $this->infoSession->bg_attachment; ?>;

    <?php if( $this->infoSession->bg_attachment == 'fixed' ): ?>
        background-repeat: repeat repeat;
    <?php else: ?>
        background-repeat: no-repeat;
    <?php endif; ?>

        background-color: <?php echo $this->infoSession->bg_color; ?>;

    <?php if( $this->infoSession->bg != '' ): ?>
        background-image: url(<?php echo URL_BASE.'public/backgrounds/'.$this->infoSession->bg; ?>);
    <?php endif; ?>
    }

    body a,
    body a:hover { color: <?php echo $this->infoSession->color_link; ?>; }

    .icons { background-color: <?php echo $this->infoSession->color_link; ?>;}
</style>

<link href="<?php echo $_layoutParams['root_css']; ?>colorbox.css" rel="stylesheet" />
<link href="<?php echo $_layoutParams['root_css']; ?>range_slide/simple-slider.css" rel="stylesheet" />
<link href="<?php echo $_layoutParams['root_css']; ?>range_slide/simple-slider-volume.css" rel="stylesheet" />
<link href="<?php echo $_layoutParams['root_css']; ?>rangeslider.css" rel="stylesheet" />
<link href="<?php echo $_layoutParams['root_css']; ?>rangeslider-new.css" rel="stylesheet" />
</head>
<!-- Body -->
<body data-max="<?php echo MAX_LENGTH; ?>">
<?php include 'views/inc/profile_summary_inc.php'; ?>
<!-- warpper_top_bar -->
<div class="warpper_top_bar">
    <!-- inner_top_bar -->
    <header class="inner_top_bar">
        <!-- padding_class -->
        <div class="padding_class">
            <a href="<?php echo URL_BASE; ?>">
                <?php include 'views/inc/logo.php'; ?>
            </a>
            <?php include 'views/inc/navigation.php'; ?>
        </div><!-- padding_class -->
    </header><!-- inner_top_bar -->
</div><!-- warpper_top_bar -->

<!-- page -->
<div class="page">
    <!-- layout -->
    <section class="layout session">
        <div class="popout"></div>
        <!-- padding_class -->
        <div class="padding_class sessionClass">
            <div class="formSearchResp">
                <form action="search/" class="formResponsive" method="get" id="search_engine" accept-charset="UTF-8">
                    <input id="btnItems" name="q" class="mention" type="text" placeholder="<?php echo $_SESSION['LANG']['search_word']; ?>" maxlength="100">
                </form>
            </div>
            <!-- wrapper_grid -->
            <div class="wrapper_grid floatLeft banner_left">

                <?php
                //<---- * advertising * --->
                include 'views/inc/advertising_left.php';
                //<---- * who_follow * --->
                //include 'views/inc/who_to_follow.php';
                //<---- * trending * --->
                include 'views/inc/trending.php';
                ?>

                <!-- Grid 1 -->
                <!--                <div class="grid_1">-->
                <!-- container_grid -->
                <!--                    <div class="container_grid about_pages">-->
                <?php// include 'views/inc/footer_session.php'; ?>
                <!--                    </div><!-- container_grid -->
                <!--                </div><!-- Grid 1 -->


            </div><!-- wrapper_grid -->

            <!-- Grid 2 -->
            <div class="grid_2 floatLeft content_center no-bg no-border ">
                <?php include 'views/inc/profile_static.php'; ?>
                <div class="grid_1 bg">
                    <!--                    <h4 class="titleBar box-class">--><?php //echo $_SESSION['LANG']['discover']; ?><!--</h4>-->
                    <!---->
                    <!--                    <span class="news_post"></span>-->

                    <ul class="posts ">

                        <div id="container-loader">
                            <div class="loading-bar"></div>
                        </div>

                        <?php
                        if( $countPost == 0 ):
                            ?>
                            <span class="notfound" style="display: none;">
                        <?php echo $_SESSION['LANG']['no_results']; ?>
                    </span>
                        <?php endif; ?>
                    </ul>
                </div>
            </div><!-- Grid 2 -->

            <!-- wrapper_grid -->
            <div class="wrapper_grid floatRight  banner_right">
<?php
                //<---- * advertising * --->
                //  include 'views/inc/advertising_right.php';
                //<---- * who_follow * --->
                //  include 'views/inc/who_to_follow.php';
                //<---- * trending * --->
                include('views/inc/advertising_right.php');
                ?>

            </div><!-- wrapper_grid -->
        </div><!-- padding_class -->
    </section><!-- layout -->
    <!-- Grid 1 -->
    <div class="grid_1  footer_new">
        <!-- container_grid -->
        <div class="container_grid about_pages">
            <?php include 'views/inc/footer_session.php'; ?>
        </div><!-- container_grid -->
    </div><!-- Grid 1 -->
</div><!-- page -->

<div class="modal">
    <div id="content_modal">
    </div>
</div>



<script src="<?php echo $_layoutParams['root_js']; ?>jquery-1.7.1.min.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery.easing.1.3.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery.placeholder.1.1.1.min.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery-ui-1.8.17.custom.min.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>functions.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>count.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>add.post.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery.form.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>timeago/jqueryTimeago_<?php echo $_SESSION['lang']; ?>.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery.colorbox.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>jquery.scroll.user.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>discover.timeline.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>range_slide/simple-slider.min.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>highcharts.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>modules/exporting.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>modules/data.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>rangeslider.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>rangeslider-new.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>pschecker.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>highcharts-more.js"></script>
<script src="<?php echo $_layoutParams['root_js']; ?>modules/solid-gauge.src.js"></script>
<?php if( !Session::get( 'authenticated' ) ) : ?>
    <script src="<?php echo $_layoutParams['root_js']; ?>login.sign.up.js"></script>
<?php endif; ?>
<?php
if(isset($_GET['category']) && is_numeric($_GET['category'])){
    $category = $_GET['category'];
}                                 else{
    $category = 0;
}

?>
<script type="text/javascript">

    $(".galeryAjax").colorbox({
        fixed: false,
        maxHeight: 550
    });

    $('.posts').empty();
    $('.posts').scrollPagination({
        nop     : 10,
        offset  : 0,
        error   : '',
        delay   : 500,

        scroll  : false,
        query   : 'ask',
        file    : 'ajax.discover.php',
        _userId : '',
        ask :<?=$this->askId?> ,
        totalGlobal : 100
    });

    jQuery(document).ready(function($) {

        $('#reply_post').live('hover', function(){
            if ($(this).data('hascharcount') == undefined) {
                $(this).data('hascharcount', true).charCount({ allowed: <?php echo MAX_LENGTH; ?>, warning: 10 });
            }
        });





    });//<-------- * DOM * ------>


</script>
</body>
</html>

